package org.yxt.springcloud.controller;

import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.yxt.springcloud.entity.CommonResult;
import org.yxt.springcloud.entity.Order;
import org.yxt.springcloud.service.OrderService;

@RestController
@RequestMapping(value = "order")
public class OrderController {

    @Autowired
    private OrderService orderService;

    /**
     * 创建订单
     * GetMapping这里是为了方便浏览器直接提交数据
     *
     * @return
     */
    @GetMapping(value = "create")
    public CommonResult create(Order order) {
        orderService.saveOrder(order);
        return new CommonResult(1, "订单创建成功", order);
    }
}
